package com.oragraph.data.instance.impl;

import java.util.Vector;

import com.oragraph.data.instance.Instance;
import com.oragraph.data.instance.InstanceFactory;
import com.oragraph.data.instance.InstanceTypeManager;
import com.oragraph.data.sourcedata.DummySourceData;

public class UserInstanceFactory implements InstanceFactory {
	
	private static InstanceFactory _singleton;
	
	static {
		_singleton=new UserInstanceFactory();
		InstanceTypeManager.registerInstanceFactory("USER", _singleton);
	}	

	@Override
	public Instance createByID(String ID) {
		// TODO
		if (DummySourceData.users.contains(ID)) {
			BasicInstance user=new BasicInstance(ID, "USER");
			user.getImmutableProperties().set("details", "DETAILS_FROM_DB");
			return user;
		}
		else return null;
	}

	@Override
	public Vector<String> listIDs() {		
		// TODO
		return DummySourceData.users;
	}

}
